package com.zelin.fastdfs;

import org.csource.fastdfs.*;

/**
 * @Author: Feng.Wang
 * @Company: Zelin.ShenZhen
 * @Description:
 * @Date: Create in 2019/6/11 16:01
 */
public class FastDfsDemo {
    public static void main(String[] args) throws  Exception{
        //1.加载fastdfs的配置文件
        ClientGlobal.init("D:\\java_1308\\pinyougou-parent\\fastDFSdemo\\src\\main\\resources\\fast_client.conf");
        //2.定义StorageServer服务器
        StorageServer storageServer = null;
        //3.定义TrackerClient
        TrackerClient trackerClient= new TrackerClient();
        //4.根据TrackerCLient得到TrackerServer对象
        TrackerServer trackerServer = trackerClient.getConnection() ;
        //5.构造StorageClient对象
        StorageClient storageClient = new StorageClient(trackerServer,storageServer);
        //6.进行文件上传
        String[] strings = storageClient.upload_file("c:/aa.jpg", "jpg", null);
        for (String string : strings) {
            System.out.println(string);
        }
        System.out.println("文件上传成功！");
    }
}
